Skip to content

fix(monitor): use optionalChains for WalletConnect Safe compatibility - #596

Open
GTC6244 wants to merge 1 commit into
mainfrom
fix-safe-walletconnect-signing
Open

fix(monitor): use optionalChains for WalletConnect Safe compatibility#596
GTC6244 wants to merge 1 commit into
mainfrom
fix-safe-walletconnect-signing

Conversation

@GTC6244

@GTC6244 GTC6244 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Signing with WalletConnect + a Gnosis Safe in the Monitor dApp broke: the Safe app opened but the transaction to sign never appeared. Root cause is that the Monitor's WalletConnect init passed chains: [chainId], which @walletconnect/ethereum-provider compiles into a requiredNamespaces entry — and Reown documents required namespaces as incompatible with smart-contract wallets like Safe (which only support the single chain they were deployed to), so the session pairs but eth_sendTransaction never routes to the wallet. This switches to optionalChains: [chainId] so the Safe can negotiate its single chain while EOA wallets (MetaMask/Rabby) keep working; methods are left to default to the full OPTIONAL_METHODS set. No automated coverage exists for WalletConnect+Safe, so this needs a manual verification pass against a live Safe on Base before landing. Note: lit-static/wallet_connect.js (dashboard billing flow) has the same latent pattern but was left untouched to avoid regressing its typed-data namespace guarantee.

🤖 Generated with Claude Code

Gnosis Safe (and any smart-contract wallet) only supports the single
chain it was deployed to. Passing `chains: [id]` to
@walletconnect/ethereum-provider builds a requiredNamespaces entry,
which Reown documents as incompatible with SCWs: the session pairs (the
Safe app opens) but eth_sendTransaction never routes to the wallet, so
the transaction to sign silently disappears. Switch to `optionalChains`
so the Safe can negotiate its single chain while EOA wallets keep working.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@GTC6244
GTC6244 requested review from a team and Copilot July 22, 2026 13:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes WalletConnect transaction signing in the Monitor dApp when used through a Gnosis Safe (smart-contract wallet) by changing the WalletConnect Ethereum Provider initialization to negotiate the chain as optional rather than required.

Changes:

  • Switch WalletConnect init from chains: [chainId] to optionalChains: [chainId] to avoid requiredNamespaces behavior that can prevent eth_sendTransaction from routing to Safe.
  • Add detailed inline rationale and a link to Reown documentation explaining the smart-contract wallet incompatibility with required namespaces.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants